package utils;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringUtil {

	static final ApplicationContext applicationContext;	
	static {		
		applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
	}

	public static ApplicationContext getApplicationcontext() {
		return applicationContext;
	}
	
	public static Object getBeanByClass(Class clazz) {					
		return applicationContext.getBean(clazz);
	}
	
	public static Object getBeanByName(String beanName) {					
		return applicationContext.getBean(beanName);
	}
}
